import org.opencv.core.Core;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.highgui.HighGui;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.imgproc.Imgproc;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86185
 * Date: 2023-04-07
 * Time: 11:56
 */
public class Pyramid {
    public static void main(String[] args) {
        System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
        Mat src = Imgcodecs.imread("src2.png");
        HighGui.imshow("th2", src);
        HighGui.waitKey(0);

        Mat dst = new Mat();
        Imgproc.pyrDown(src, dst);//向下采样
        HighGui.imshow("down", dst);
        HighGui.waitKey(0);
        Imgproc.pyrUp(dst, dst);
        HighGui.imshow("up", dst);//向上采样
        HighGui.waitKey(0);

        Mat mat = new Mat(src.size(), CvType.CV_64F);
        Core.subtract(dst, src, mat);//做差，出轮廓
        HighGui.imshow("Lap", mat);
        HighGui.waitKey(0);
    }
}
